﻿Imports AjaxControlToolkit

Partial Class MyProfile
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Accordion1.SelectedIndex = -1
            If Not IsNothing(Session("UserObject")) Then
                lblMyCustomerID.Text = CType(Session("UserObject"), User).CustomerID
                lblMyUserID.Text = CType(Session("UserObject"), User).UserID
            End If
        End If
    End Sub

    Protected Sub btnCancel_Click(sender As Object, e As System.EventArgs)
        'Get the row modal and show it
        ViewState("rowindex") = gvwOrders.SelectedIndex
        Dim modal As ModalPopupExtender = CType(gvwOrders.SelectedRow.FindControl("modCancel"), ModalPopupExtender)
        modal.Show()
    End Sub
    Protected Sub btnCancelLine_Click(sender As Object, e As System.EventArgs)
        Dim tmlBtn As Button = CType(sender, Button)
        If Order.CancelOrderLine(tmlBtn.CommandArgument) Then
            'Get selected Index before binding
            gvwOrders.DataBind()
            gvwOrders.SelectedIndex = ViewState("rowindex")
            btnCancel_Click(sender, e)
        Else
            CType(gvwOrders.SelectedRow.FindControl("lblLineErrors"), Label).Text = "An error occurred, please try again."
        End If
    End Sub
    Public Function GetMaskedString(ByVal tmp As String) As String
        Return Utility.GetMaskedString(tmp, 4)
    End Function

    Protected Sub btnAddCard_Click(sender As Object, e As System.EventArgs) Handles btnAddCard.Click
        modCardAdd.Show()
    End Sub

    Protected Sub btnModAddOk_Click(sender As Object, e As System.EventArgs) Handles btnModAddOk.Click
        modCardAdd.Hide()
        gvwCards.DataBind()
    End Sub
End Class
